const express = require('express');


const cors = require('cors');
const router = require('./router')

const swaggerJsdoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');

const app = express();

// Define Swagger options
const options = {
  definition: {
    openapi: '3.0.0',
    info: {
      title: 'Your API Documentation',
      version: '1.0.0',
      description: 'API documentation generated with Swagger',
    },
  },
  apis: ['router.js']
};

// Initialize Swagger-jsdoc
const specs = swaggerJsdoc(options);

// Serve Swagger UI
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(specs));

const PORT = 8000;

// Подключение к PostgreSQL

app.use(express.json());
app.use(cors())
app.use("/api", router)



app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`)
});
